#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
    for(int i=10000;i<=99999;i++){
        int a,b,s=0;
        a=i/10000;
        b=i%10000;
        s=s+(a*b);
        a=i/1000;
        b=i%1000;
        s=s+(a*b);
        a=i/100;
        b=i%100;
        s=s+(a*b);
        a=i/10;
        b=i%10;
        s=s+(a*b);
        if(s==i)cout<<i<<" ";
    }
    return  0;
}
